﻿using Microsoft.AspNetCore.Mvc;
using NanjingbeiRailwayStation.Core;
using NanjingbeiRailwayStation.Data.ClickHouse.Entities;
using NanjingbeiRailwayStation.Data.ClickHouse.Services;

namespace NanjingbeiRailwayStation.WebApi.Controllers
{
    /// <summary>
    /// 设备所有者
    /// </summary>
    [ApiController]
    [Route("[controller]")]
    public class DeviceOwnerController : ControllerBase
    {

        /// <summary>
        /// 获取 设备所有者
        /// </summary>
        /// <param name="imei"></param>
        /// <returns></returns>
        [HttpGet("GetDeviceOwner")]
        public async Task<ResultRespose<Data.ClickHouse.Entities.DeviceOwner>> GetDeviceOwner(string imei)
        {
            var entity = await new DeviceOwnerService().GetDeviceOwner(imei);
            return ResultRespose<DeviceOwner>.BadWithData(entity??new DeviceOwner());

        }

    }
}